home *** CD-ROM | disk | FTP | other *** search
/ Aminet 52 / Aminet 52 (2002)(GTI - Schatztruhe)[!][Dec 2002].iso / Aminet / game / patch / WHDIGamesU-Z.lzh / WayOfTheLittleDragon.lha / WayOfTheLittleDragonHD / Install-LittleDragon next >
Text File  |  2002-03-13  |  8KB  |  290 lines

  1. ;****************************
  2.  
  3. (set #sub-dir "data")            ;sub directory containing data files
  4. (set #readme-file "ReadMe")        ;name of readme file
  5. (set #man-file "Manual")        ;name of manual file
  6. (set #hint-file "Hints")        ;name of hint file
  7. (set #sol-file "Solution")        ;name of solution file
  8. (set #highs-file "highs")        ;name of high scores file
  9.  
  10. ;****************************
  11. ;----------------------------
  12. (procedure P_Install
  13.   (set #version
  14.     (askchoice
  15.       (prompt "Which version of \"The way of the Little Dragon\" do you like to install?")
  16.       (default 0)
  17.       (choices "1 Disk version" "Magic Bytes compilation")
  18.       (help @askchoice-help)
  19.     )
  20.   )
  21.   (select #version
  22.     (
  23.       (set #AD_disk "THE WAY OF THE LITTLE ")
  24.       (P_disk)
  25.       (copyfiles
  26.         (help @copyfiles-help)
  27.         (source ("%s:" #AD_disk))
  28.         (dest #dest)
  29.         (pattern "~(c|s|system|.info|NORAM!)")
  30.       )
  31.     )
  32.     (
  33.       (set #AD_disk "SpinWorld")
  34.       (P_disk)
  35.       (copyfiles
  36.         (help @copyfiles-help)
  37.         (source ("%s:" #AD_disk))
  38.         (pattern "~(datas|devs|s|1|2|assign|nfm|run|subbp|type|wait)")
  39.         (dest #dest)
  40.       )
  41.       (if
  42.        (= 0 (run ("xfddecrunch %s:2 \"%s/aa\" FORCE CA >CON:///1000//CLOSE " #AD_disk #dest)))
  43.        ("")
  44.        (abort "\"xfddecrunch\" has failed to decompress the file")
  45.       )
  46.     )
  47.   )
  48. )
  49.  
  50. ;----------------------------
  51. ; checks if given program is installed, if not abort install
  52. ; #program - to check
  53.  
  54. (procedure P_ChkRun
  55.   (if
  56.     (= 0 (run ("cd SYS:\nWhich %s" #program)))
  57.     ("")
  58.     (abort
  59.       (cat
  60.     "You must install \"" #program "\" first!\n"
  61.     "It must be accessible via the path.\n"
  62.     "You can find it in the WHDLoad package."
  63.       )
  64.     )
  65.   )
  66. )
  67.  
  68. ;----------------------------
  69. ; Wait for inserting disk
  70. ; IN:  #AD_disk - name of disk
  71. ; OUT: -
  72.  
  73. (procedure P_disk
  74.   (askdisk
  75.     (dest #AD_disk)
  76.     (prompt ("\nInsert Disk \"%s\" in any drive!" #AD_disk))
  77.     (help @askdisk-help)
  78.   )
  79. )
  80.  
  81. ;----------------------------
  82. ; copy file including icon if exist
  83. ; #copy-file - name of file to copy
  84.  
  85. (procedure P_CopyFile
  86.   (if
  87.     (exists #copy-file)
  88.     (
  89.       (copyfiles
  90.         (help @copyfiles-help)
  91.         (source #copy-file)
  92.         (dest #dest)
  93.       )
  94.       (if
  95.         (exists ("%s.info" #copy-file))
  96.         (
  97.           (copyfiles
  98.             (help @copyfiles-help)
  99.             (source ("%s.info" #copy-file))
  100.             (dest #dest)
  101.           )
  102.           (tooltype
  103.             (dest (tackon #dest #copy-file))
  104.             (noposition)
  105.           )
  106.         )
  107.       )
  108.     )
  109.   )
  110. )
  111.  
  112. ;****************************
  113.  
  114. (if
  115.   (< @installer-version (+ (* 44 65536) 10))
  116.   (abort
  117.     (cat
  118.       "Sorry, your installer is to old to perform this installation.\n"
  119.       "You have version " (/ @installer-version 65536) "." 
  120.       (BITAND @installer-version 65535) ", needed is at least version 44.10.\n"
  121.       "The latest installer can be obtained from:\n"
  122.       "'aminet:util/...' or 'ftp://ftp.amiga.com/'."
  123.     )
  124.   )
  125. )
  126.  
  127. (if
  128.   (exists #readme-file)
  129.   (if
  130.     (= 0 (run ("SYS:Utilities/Multiview %s" #readme-file)))
  131.     ("")
  132.     (run ("SYS:Utilities/More %s" #readme-file))
  133.   )
  134. )
  135.  
  136. (set #program "WHDLoad")
  137. (P_ChkRun)
  138.  
  139. (if
  140.   (getenv "WHDLInstPath")
  141.   (set @default-dest (getenv "WHDLInstPath"))
  142. )
  143. (set #dest
  144.   (askdir
  145.     (prompt
  146.       (cat
  147.     "Where should \"" @app-name "\" be installed?\n"
  148.     "A drawer \"" @app-name "\" will be automatically created."
  149.       )
  150.     )
  151.     (help @askdir-help)
  152.     (default @default-dest)
  153.   )
  154. )
  155. (run ("setenv WHDLInstPath \"%s\"\ncopy ENV:WHDLInstPath ENVARC:" #dest))
  156. (set #dest (tackon #dest @app-name))
  157. (if
  158.   (exists #dest)
  159.   (
  160.     (set #choice
  161.       (askbool
  162.         (prompt
  163.           (cat
  164.             "\nDirectory \"" #dest "\" already exists.\n"
  165.             "Should it be deleted?"
  166.           )
  167.         )
  168.         (default 1)
  169.         (choices "Delete" "Skip")
  170.         (help @askbool-help)
  171.       )
  172.     )
  173.     (if
  174.       (= #choice 1)
  175.       (delete #dest
  176.         (help @delete-help)
  177.         (all)
  178.       )
  179.     )
  180.   )
  181. )
  182. (makedir #dest
  183.   (help @makedir-help)
  184.   (infos)
  185. )
  186.  
  187. ;----------------------------
  188.  
  189. (copyfiles
  190.   (help @copyfiles-help)
  191.   (source ("%s.Slave" @app-name))
  192.   (dest #dest)
  193. )
  194. (if (exists ("%s.glowexot"  @app-name)) ((set #icon 7)(set #icnt (+ 1 #icnt))(set #icon-gex "Exotic GlowIcon")) (set #icon-gex ""))
  195. (if (exists ("%s.newexot"   @app-name)) ((set #icon 6)(set #icnt (+ 1 #icnt))(set #icon-nex "Exotic NewIcon"))  (set #icon-nex ""))
  196. (if (exists ("%s.exoticon"  @app-name)) ((set #icon 5)(set #icnt (+ 1 #icnt))(set #icon-exo "Exoticon"))        (set #icon-exo ""))
  197. (if (exists ("%s.glowicon"  @app-name)) ((set #icon 4)(set #icnt (+ 1 #icnt))(set #icon-glo "Glow Icon"))       (set #icon-glo ""))
  198. (if (exists ("%s.coloricon" @app-name)) ((set #icon 3)(set #icnt (+ 1 #icnt))(set #icon-col "OS3.5 Icon"))      (set #icon-col ""))
  199. (if (exists ("%s.newicon"   @app-name)) ((set #icon 2)(set #icnt (+ 1 #icnt))(set #icon-new "NewIcon"))         (set #icon-new ""))
  200. (if (exists ("%s.romicon"   @app-name)) ((set #icon 1)(set #icnt (+ 1 #icnt))(set #icon-rom "RomIcon"))         (set #icon-rom ""))
  201. (if (exists ("%s.inf"       @app-name)) ((set #icon 0)(set #icnt (+ 1 #icnt))(set #icon-nor "Normal"))          (set #icon-nor ""))
  202. (procedure P_Icon
  203.   (copyfiles
  204.     (help @copyfiles-help)
  205.     (source ("%s.%s" @app-name #icon-suf))
  206.     (newname ("%s.info" #icon-name))
  207.     (dest #icon-dir)
  208.   )
  209.   (tooltype
  210.     (dest (tackon #icon-dir #icon-name))
  211.     (noposition)
  212.   )
  213. )
  214. (if
  215.   (> #icnt 1)
  216.   (
  217.     (set #icon-dir ("T:%s Icons" @app-name))
  218.     (makedir #icon-dir
  219.       (help @makedir-help)
  220.     )
  221.     (if #icon-nor ((set #icon-suf "inf")      (set #icon-name "Normal")          (P_Icon)))
  222.     (if #icon-rom ((set #icon-suf "romicon")  (set #icon-name "RomIcon")         (P_Icon)))
  223.     (if #icon-new ((set #icon-suf "newicon")  (set #icon-name "NewIcon")         (P_Icon)))
  224.     (if #icon-col ((set #icon-suf "coloricon")(set #icon-name "OS3.5 Icon")      (P_Icon)))
  225.     (if #icon-glo ((set #icon-suf "glowicon") (set #icon-name "Glow Icon")       (P_Icon)))
  226.     (if #icon-exo ((set #icon-suf "exoticon") (set #icon-name "Exoticon")        (P_Icon)))
  227.     (if #icon-nex ((set #icon-suf "newexot")  (set #icon-name "Exotic NewIcon")  (P_Icon)))
  228.     (if #icon-gex ((set #icon-suf "glowexot") (set #icon-name "Exotic GlowIcon") (P_Icon)))
  229.     (openwbobject #icon-dir)
  230.     (set #icon
  231.       (askchoice
  232.         (prompt "\nWhich icon would you like to install?\n")
  233.         (choices #icon-nor #icon-rom #icon-new #icon-col #icon-glo #icon-exo #icon-nex #icon-gex)
  234.         (default #icon)
  235.         (help @askchoice-help)
  236.       )
  237.     )
  238.     (closewbobject #icon-dir)
  239.     (delete #icon-dir
  240.       (help @delete-help)
  241.       (all)
  242.     )
  243.   )
  244. )
  245. (select #icon
  246.   (set #icon "inf")
  247.   (set #icon "romicon")
  248.   (set #icon "newicon")
  249.   (set #icon "coloricon")
  250.   (set #icon "glowicon")
  251.   (set #icon "exoticon")
  252.   (set #icon "newexot")
  253.   (set #icon "glowexot")
  254. )
  255. (copyfiles
  256.   (help @copyfiles-help)
  257.   (source ("%s.%s" @app-name #icon))
  258.   (newname ("%s.info" @app-name))
  259.   (dest #dest)
  260. )
  261. (set #copy-file #readme-file)
  262. (P_CopyFile)
  263. (set #copy-file #man-file)
  264. (P_CopyFile)
  265. (set #copy-file #hint-file)
  266. (P_CopyFile)
  267. (set #copy-file #sol-file)
  268. (P_CopyFile)
  269. (set #dest-org #dest)
  270. (if
  271.   (= #sub-dir "")
  272.   ("")
  273.   (
  274.     (set #dest (tackon #dest #sub-dir))
  275.     (makedir #dest
  276.       (help @makedir-help)
  277.     )
  278.   )
  279. )
  280. (copyfiles
  281.   (help @copyfiles-help)
  282.   (source ("OSEmu.exe" @app-name))
  283.   (dest #dest)
  284. )
  285. (set #copy-file #highs-file)
  286. (P_CopyFile)
  287. (P_Install)
  288. (openwbobject #dest-org)
  289. (exit)
  290.